


    ## WinBUGS code for a Varying-Intercept Model with Congress-Level Predictor  
    
    model {
    for (i in 1:N){
        Y[i] ~ dnorm(mu.y[i], tau.y)
        mu.y[i] <- alpha[congress[i]] + 
                   beta[1]*X1[i] + 
                   beta[2]*X2[i] + 
                   beta[3]*X3[i] + 
                   beta[4]*X4[i] +
                   beta[5]*X5[i] +
                   beta[6]*X6[i] +
                   beta[7]*X7[i] +
                   beta[8]*X8[i]
        }


        # priors
        for (i in 1:n.beta){
        beta[i] ~ dnorm(0, 0.1)
        }
        tau.y <- pow(sigma.y, -2)
        sigma.y ~ dunif(0, 100)
        
        for (j in 1:J){
        alpha[j] ~ dnorm(mu.alpha[j], tau.alpha)
        mu.alpha[j] <- gamma[1] + 
                       gamma[2]*Z1[j] + 
                       gamma[3]*Z2[j] +
                       gamma[4]*Z3[j]                 
        }

        # priors
        for (i in 1:n.gamma){
        gamma[i] ~ dnorm(0, 0.1)
        }
        tau.alpha <- pow(sigma.alpha, -2)
        sigma.alpha ~ dunif(0, 100)
    }

